// pages/gc/gc.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    screenWidth: 0,
    screenHeight: 0,
    arr: [
      {
        id: 1,
        tx: "../image/gc/tx.png",
        imga: "../image/gc/dianzan.png",
        name: '王晓东',
        time: '昨天22：40发布',
        content: "在公园玩了一天，完成了很多任务，好有趣。",
        imga1: "../image/gc/green.png",
        num1: 256,
        imga2: "../image/gc/dianzan.png",
        num2: 36,
        imga3: "../image/gc/pinglun.png"
      },
      {
        id: 2,
        tx: "../image/gc/tx.png",
        imga: "../image/gc/dianzan.png",
        name: '悦悦',
        time: '昨天0000发布',
        content: "飞洒老年妇女你姐 奥i认为看能否你",
        imga1: "../image/gc/green.png",
        num1: 999,
        imga2: "../image/gc/dianzan.png",
        num2: 222,
        imga3: "../image/gc/pinglun.png"
      }
    ]
  },
  dt: function (e) {
    var arr = this.data.arr;
    var arr2 = [];
    var id = e.currentTarget.id;
    // var app = getApp()
    // app.requestDetailid = id;
    // console.log(id)
    for (var i = 0; i < arr.length; i++) {
      if (id == arr[i].id) {
        // arr2 = arr[i]
        arr2.push(arr[i])
      }
    }
    console.log(arr2)
    wx.navigateTo({
      url: './dt?arr2=' + arr2,
      success: function (res) {
        // 通过eventChannel向被打开页面传送数据
        // console.log(arr2)
        res.eventChannel.emit('acceptDataFromOpenerPage', arr2)
      }
    })
  },
  fabu:function(){
    wx.navigateTo({
      url: './fbdt',
      success: function(res){
        // success
      },
      fail: function() {
        // fail
      },
      complete: function() {
        // complete
      }
    })
  },

  onLoad: function (options) {
    var that = this;
    wx.getSystemInfo({
      success: function (res) {
        console.log(res)
        that.setData({
          screenWidth: res.screenWidth,
          screenHeight: res.screenHeight
        })
      }
    })
  }
})